
import Subject from '../script/subject';
const { ccclass, property } = cc._decorator;

@ccclass
export class SubjectComponent extends cc.Component {

    protected _subject: Subject = new Subject();

    on(eventName: string, cb: Function, node: any) {
        return this._subject.on( eventName, cb, node );
    }
    off(node: any, eventName?: string, cb?: Function) {
        return this._subject.off( node, eventName, cb );
    }
    remit(msg: any | undefined, eventName: string) {
        this._subject.remit( msg, eventName );
    }

    emit(eventName: string, msg?: any) {
        this._subject.emit( eventName, msg );
    }
};